<template>
  <!-- 护士 -->
  <section class="index-job">
    <div class="nav-box">
      <div class="title form-tool">
        <div style="font-size:18px;">当前患者信息</div>
        <div>
          <el-link :underline="false" @click="switchWindow('patient')"><i class="el-icon-circle-plus" style="font-size:20px;"></i></el-link>
        </div>
      </div>
      <div ref="patientObj-el" :style="{height:patientObj.isShow?boxHeight(patientObj):'0'}" class="transform_5 item-nr">
        <div style="border-top:1px solid #eee;"></div>
        <!-- <table width="100%" style="border:none;">
          <tr>
            <td style="text-align:right;">
              <el-form :inline="true" @submit.native.prevent="onSearchJob(-1)">
                <el-form-item style="margin-bottom:0;">
                  <deptSearch></deptSearch>
                </el-form-item>
                <el-form-item style="margin-bottom:0;">
                  <el-input placeholder="患者姓名/手机号"></el-input>
                </el-form-item>
                <el-form-item style="margin-bottom:0;">
                  <el-button type="primary" native-type="submit" circle icon="el-icon-search"></el-button>
                </el-form-item>
              </el-form>
            </td>
          </tr>
        </table> -->
        <br>
        <table class="grid-table">
          <thead>
            <tr>
              <th></th>
              <th>实验室检查</th>
              <th>辅助检查</th>
              <th>治疗</th>
              <th>处方</th>
            </tr>
          </thead>
          <tbody>
            <tr v-for="(item,index) in patientObj.list" :key="index">
              <td style="vertical-align: top;">
                <div>患者：{{item.patientName}}</div>
                <div>医生：{{item.doctorName}}</div>
              </td>
              <td style="vertical-align: top;">
                <div v-for="(item,index) in item.cureCheckupInfo" :key="index" style="margin-bottom:5px;">
                  <span class="vertical-middle">{{item.value}}</span>
                  <i v-if="item.status" class="el-icon-check vertical-middle success-color"></i>
                  <i v-else class="el-icon-close vertical-middle error-color"></i>
                </div>
              </td>
              <td style="vertical-align: top;">
                <div v-for="(item,index) in item.cureCheckAssistInfo" :key="index" style="margin-bottom:5px;">
                  <span class="vertical-middle">{{item.value}}</span>
                  <i v-if="item.status" class="el-icon-check vertical-middle success-color"></i>
                  <i v-else class="el-icon-close vertical-middle error-color"></i>
                </div>
              </td>
              <td style="vertical-align: top;">
                <div v-for="(item,index) in item.cureAdviceInfo" :key="index" style="margin-bottom:5px;">
                  <span class="vertical-middle">{{item.value}}</span>
                  <i v-if="item.status" class="el-icon-check vertical-middle success-color"></i>
                  <i v-else class="el-icon-close vertical-middle error-color"></i>
                </div>
              </td>
              <td style="vertical-align: top;">
                <div v-for="(item,index) in item.curePrescriptionInfo" :key="index" style="margin-bottom:5px;">
                  <span class="vertical-middle">{{item.value}}</span>
                  <i v-if="item.status" class="el-icon-check vertical-middle success-color"></i>
                  <i v-else class="el-icon-close vertical-middle error-color"></i>
                </div>
              </td>
            </tr>
          </tbody>
        </table>
      </div>
    </div> 
  </section>
</template>
<script>
export default {
  computed: {

  },
  components: {
    deptSearch: () => import("@/pages/_com/deptSearch.vue"),
    doctorSearch: () => import("@/pages/_com/doctorSearch.vue")
  },
  data() {
    return {
      patientObj: {
        isShow: true,
        elHeight: "auto",
        list: []
      },
     
    };
  },
  created() {
    let th = this; 
    th.getPatientData();
   
  },
  mounted() {
    let th = this;
   
  },
  methods: {
   
   
    //窗口收缩
    switchWindow(type) {
      let th = this;
      switch (type) {
        case "patient":
          if (th.patientObj.isShow) {
            th.patientObj.elHeight = th.$refs["patientObj-el"].scrollHeight;
          }
          th.patientObj.isShow = !th.patientObj.isShow;
          break;
        case "jiaohao":
          if (th.jiaoHaoObj.isShow) {
            th.jiaoHaoObj.elHeight = th.$refs["jiaohao-el"].scrollHeight;
          }
          th.jiaoHaoObj.isShow = !th.jiaoHaoObj.isShow;
          break;
      }
    },
    //查询患者信息
    getPatientData() {
      let th = this;
      th.$api.patientnurseWorkbenchlist({}).then(res => {
        if (res.executed) {
          th.patientObj.list = res.data;
          th.$nextTick(function() {
            th.patientObj.elHeight = th.$refs["patientObj-el"].scrollHeight;
          });
        }
      });
    }, 
    //转换高度
    boxHeight(obj) {
      let th = this;
      if (typeof obj.elHeight == "number") return obj.elHeight + "px";
      else return obj.elHeight;
    }
  }
};
</script>
